// MaxSubsetSum.cpp
#include <vector>
#include <iostream>

using namespace std;

int maxSubsetSum(vector<int> array) {
  vector<int> result(array.size(), 0);

  result[0] = array[0];
  result[1] = max(array[0], array[1]);

  for (int i = 2; i < array.size(); ++i) {
    result[i] = max(result[i - 1], array[i] + result[i - 2]);
  }

  return *(result.end() - 1);
}

int main(int argc, char const *argv[])
{
  /* code */
  vector<int> test {75, 105, 120, 75, 90, 135};
  int result = maxSubsetSum(test);

  cout<<result<<endl;
  return 0;
}

